#include<iostream>
using namespace std;

// #define DEBUG_MOD
#ifdef DEBUG_MOD
#define LOG(str,len,X,Y)    cout << __LINE__ << ':';    \
                        for (int i = 0; i < len; i++)   \
                        {                               \
                            cout << str[i];             \
                        }                               \
                        cout << ' ' << X << ',' << Y << endl
#else
#define LOG(str,len,X,Y)
#endif

const int STR_LEN = 10;
char tempStr[STR_LEN] = {0};
int tempIndex = 0;
void clearStr(char* tempStr,int& tempIndex)
{
    for (int i = 0; i < tempIndex; i++)
    {
        tempStr[i]= 0;
    }
    tempIndex=0;
}

int main()
{
    char input[10001] = {0};
    int X=0, Y=0;
    cin >> input;

    for (char *p = input; *p != 0; p++)
    {
        if (*p != ';')
        {
            tempStr[tempIndex++] = *p;
        }
        else if(tempIndex > 1 && 
                tempIndex <= 3) // 筛除：截至';'处长度小于1或大大于3的。
        {
            //计算移动步长
            int moveStep = 0;
            if(tempStr[1] >= '0' && 
               tempStr[1] <= '9')
            {
                moveStep = static_cast<int>(tempStr[1] - '0');
            }
            if(tempStr[2] >= '0' && 
               tempStr[2] <= '9')
            {
                moveStep = moveStep*10 + static_cast<int>(tempStr[2] - '0');
            }
            else if(tempStr[2] != 0)
            {
                moveStep = 0;
            }
            
            // 移动方向
            switch (tempStr[0])
            {
                case 'A':X -= moveStep;break;
                case 'D':X += moveStep;break;
                case 'S':Y -= moveStep;break;
                case 'W':Y += moveStep;break;
                default:break;
            }
            
            LOG(tempStr,tempIndex,X,Y);
            clearStr(tempStr,tempIndex);
        }
        else
        {
            LOG(tempStr,tempIndex,X,Y);
            clearStr(tempStr,tempIndex);
        }
    }
    cout << X << ',' << Y << endl;
    
    return 0;
}